﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Xml.Serialization;

namespace PMC.Urls.Default
{
    [DataContract]
    public struct EmailFetcherSettings
    {
        [DataMember]
        public string Username { get; set; }

        public string Password { get; set; }

        [DataMember]
        public int Port { get; set; }

        [DataMember]
        public string Host { get; set; }

        [DataMember(Name = "SSL")]
        public bool Ssl { get; set; }

        [DataMember(Name = "Password")]
        private string savePassword
        {
            get
            {
                return PMC.Global.EncryptString(Password);
            }
            set
            {
                Password = PMC.Global.DecryptString(value);
            }
        }

        public override int GetHashCode()
        {
            return Username.GetHashCode() ^ Password.GetHashCode() ^ Port.GetHashCode() ^ Ssl.GetHashCode();
        }
    }
}
